<?php
namespace Home\Controller;
use Think\Controller;

class ClubadminController extends PublicController {
    /*俱乐部管理员列表  开发人：卞旭*/
    public function clubadminlist(){
        $clubadmin=M('clubadmin');
        $clubadmin=$clubadmin->select();
        $this->assign('clubadmin',$clubadmin);
        $this->display();
    }
    /*添加俱乐部管理员页  开发人：卞旭*/
    public function addclubadmin(){
        $club = M('club');
        $club = $club->select();
        $this->assign('club',$club);
        $this->display();
    }
    /*添加俱乐部管理员页 开发人：卞旭*/
    public function add(){
        $club=I('post.club');       
        $clubadmin = M('clubadmin');
        $clubadmin->club=$club;
        $clubadmin->pwd='123';
        if($clubadmin->create()){
            if (false !== $clubadmin->add()) {
                $this->success('添加成功！', '');
            } else {         
                $this->error('数据错误','');           
            }
        }else {            
            $this->error($clubadmin->getError());  
        }
    }
    /*重置密码 开发人：卞旭*/
    public function edituser($adminid){
        $clubadmin=M('clubadmin');
        $data['pwd']='123456';
        $clubadmin=$clubadmin->where("adminid='$adminid'")->save($data);
        if($clubadmin=1){
            $this -> success('重置成功',U('Clubadmin/clubadminlist'));
        }else{
            echo "error";
        }
    }
}
